***************************************
*         EMPIRICAL ANALYSES
* The Geography of Support for Political
*                Violence
* B. Kal Munis, PhD, Utah Valley University
* Arif Memovic, PhD Student, Penn State
* Olyvia Christley, PhD, Florida Atlantic University
*
****************************************
clear all

set scheme s1mono
*setting working directory
cd [insert file path on your computer here]

*reading in the data
use [insert file path on your computer here]

*Note: The firt set of analyses presented below are without survey weights. Then each of the analyses is replicated twice further below in the .do file, first with the "main" weighting scheme referenced in the manuscript and then with a second weighting scheme.

************************
* Descriptives
************************
sum ruralresentment, det

sum morning_consult, det
tab morning_consult

sum ordinary_violence, det
tab ordinary_violence
************************
* BIVARIATE REGRESSIONS
************************

reg morning_consult rural
ologit morning_consult rural


reg ordinary_violence rural
ologit ordinary_violence rural

reg morning_consult ruralresentment
ologit morning_consult ruralresentment

reg ordinary_violence ruralresentment
ologit ordinary_violence ruralresentment



************************
* MULTIVARIATE REGRESSIONS
************************

reg morning_consult rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
ologit morning_consult rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
margins, at(rural=(0/1)) predict(outcome(1))
margins, at(rural=(0/1)) predict(outcome(2)) 
margins, at(rural=(0/1)) predict(outcome(3)) 
margins, at(rural=(0/1)) predict(outcome(4)) 
margins, at(rural=(0/1)) predict(outcome(5)) 

reg ordinary_violence rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
ologit ordinary_violence rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1


reg morning_consult ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
ologit morning_consult ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
margins, at(ruralresentment=(0/1)) predict(outcome(1)) 
margins, at(ruralresentment=(0/1)) predict(outcome(2)) 
margins, at(ruralresentment=(0/1)) predict(outcome(3)) 
margins, at(ruralresentment=(0/1)) predict(outcome(4)) 
margins, at(ruralresentment=(0/1)) predict(outcome(5)) 

reg ordinary_violence ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
ologit ordinary_violence ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1






mi set wide
mi register imputed morning_consult lazy_blacks populism ideology
mi register regular age male white college pid5 rural
mi impute mvn lazy_blacks populism ideology = age male white college pid5 rural, add(20) rseed(1389)
mi estimate: reg morning_consult rural age male white college i.pid5 ideology lazy_blacks populism


****************
* Bar graphs (corrected to use weights)
****************

*Figure 1
catplot morning_consult, percent var1opts(label(labsize(small))) var2opts(label(labsize(small))) title("Support for Political Violence Against the State (weighted full sample)",size(small)) ytitle("Percent of Respondents", size(small)) l1title("", size(small)), [aweight=weight1]


catplot rural morning_consult, percent(rural) var1opts(label(labsize(small))) var2opts(label(labsize(small))) title("Support for Political Violence Against the State by Self-Reported Geographic Residency",size(small)) ytitle("Percent of Respondents by Geographic Geographic Residency", size(small)) asyvars, [aweight=weight1]



*Figure 2
*graph bar, over(ordinary_violence)
*graph bar if rural==1, over(ordinary_violence, label)
*graph bar if rural==0, over(ordinary_violence, label)

catplot ordinary_violence, percent var1opts(label(labsize(small))) var2opts(label(labsize(small))) title("Support for Political Violence Against Other Ordinary Citizens (full sample)",size(small)) ytitle("Percent of Respondents", size(small)) l1title("", size(small)), [aweight=weight1]


catplot rural ordinary_violence, percent(rural) var1opts(label(labsize(small))) var2opts(label(labsize(small))) title("Support for Political Violence Against Other Ordinary Citizens by Geographic Self-Identification",size(small)) ytitle("Percent of Respondents by Geographic Self-Identification", size(small)) asyvars, [aweight=weight1]

*Do you think it is ever justifiable for ordinary American citizens to take up arms against other ordinary citizens for political reasons?


*******************************************
*******************************************
* REPLICATING THE ABOVE WITH SURVEY WEIGHTS
*******************************************
*******************************************
clear all

set scheme s1mono
*setting working directory
cd "C:\Users\kalmu\OneDrive\UVU\research\data"

*reading in the data
use "C:\Users\kalmu\OneDrive\UVU\research\data\clean_data_arif.dta"

svyset [pweight=weight1]
*Our first post-stratification rake weights are constructed using 2020 American National Election Studies estimates as the "true" population parameters for the following variables: self-reported rural residency (including both "rural" and "small town"), binary gender, income (collapsed to same coding scheme that I list in the codebook), binary 4 year college education or more, binary racial self-report (white vs non-white), and 7 point ideological self-report.

**********************************************
*Descriptives
**********************************************
svy:mean ruralresentment

sum morning_consult
svy:tab morning_consult

svy:mean ordinary_violence
svy:tab ordinary_violence

************************
* BIVARIATE REGRESSIONS
************************
svy:reg morning_consult rural
svy:ologit morning_consult rural


svy:reg ordinary_violence rural
svy:ologit ordinary_violence rural

svy:reg morning_consult ruralresentment
svy:ologit morning_consult ruralresentment


svy:reg ordinary_violence ruralresentment
svy:ologit ordinary_violence ruralresentment

*******************************
* MULTIVARIATE REGRESSION
*******************************

svy:reg morning_consult rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit morning_consult rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
margins, at(rural=(0/1)) predict(outcome(1))
margins, at(rural=(0/1)) predict(outcome(2)) 
margins, at(rural=(0/1)) predict(outcome(3)) 
margins, at(rural=(0/1)) predict(outcome(4)) 
margins, at(rural=(0/1)) predict(outcome(5)) 

svy:reg ordinary_violence rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit ordinary_violence rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1


svy:reg morning_consult ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit morning_consult ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
margins, at(ruralresentment=(0/1)) predict(outcome(1)) 
margins, at(ruralresentment=(0/1)) predict(outcome(2)) 
margins, at(ruralresentment=(0/1)) predict(outcome(3)) 
margins, at(ruralresentment=(0/1)) predict(outcome(4)) 
margins, at(ruralresentment=(0/1)) predict(outcome(5)) 

svy:reg ordinary_violence ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit ordinary_violence ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1

**********************************************************************
**********************************************************************
* ALTERNATIVE WEIGHTING SCHEME
**********************************************************************
**********************************************************************
clear all

set scheme s1mono
*setting working directory
cd "C:\Users\kalmu\OneDrive\UVU\research\data"

*reading in the data
use "C:\Users\kalmu\OneDrive\UVU\research\data\clean_data_arif.dta"


svyset [pweight=weight2]
*Our alternative post-stratification rake weights are identical to the first set of weights except that we used the U.S. Census rural proportion of the U.S. population estimate as the "true" population parameter for rural residency

************************
* BIVARIATE REGRESSIONS
************************
svy:reg morning_consult rural
svy:ologit morning_consult rural


svy:reg ordinary_violence rural
svy:ologit ordinary_violence rural

svy:reg morning_consult ruralresentment
svy:ologit morning_consult ruralresentment


svy:reg ordinary_violence ruralresentment
svy:ologit ordinary_violence ruralresentment

*******************************
* MULTIVARIATE REGRESSION
*******************************

svy:reg morning_consult rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit morning_consult rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
margins, at(rural=(0/1)) predict(outcome(1))
margins, at(rural=(0/1)) predict(outcome(2)) 
margins, at(rural=(0/1)) predict(outcome(3)) 
margins, at(rural=(0/1)) predict(outcome(4)) 
margins, at(rural=(0/1)) predict(outcome(5)) 

svy:reg ordinary_violence rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit ordinary_violence rural age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1


svy:reg morning_consult ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit morning_consult ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
margins, at(ruralresentment=(0/1)) predict(outcome(1)) 
margins, at(ruralresentment=(0/1)) predict(outcome(2)) 
margins, at(ruralresentment=(0/1)) predict(outcome(3)) 
margins, at(ruralresentment=(0/1)) predict(outcome(4)) 
margins, at(ruralresentment=(0/1)) predict(outcome(5)) 

svy:reg ordinary_violence ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1
svy:ologit ordinary_violence ruralresentment age male white college i.pid5 ideology lazy_blacks populism i.region i.income if attention_total>1